import { NgModule } from '@angular/core';
import { RouterModule, NavigationEnd, Router } from '@angular/router';  
import { TechfileComponent } from './techfile/techfile.component';
import { LocationComponent } from './location/location.component';
import { BorrowtechfileComponent } from './borrowtechfile/borrowtechfile.component';
import { CirculationfileComponent } from './circulationfile/circulationfile.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [ 
                    { path: 'techfile', component: TechfileComponent , data: { permission: 'Pages.TechFile.Index' } },
                    { path: 'borrowtechfile', component: BorrowtechfileComponent , data: { permission: 'Pages.TechFile.BorrowTechfile' } },
                    { path: 'location', component: LocationComponent , data: { permission: 'Pages.TechFile.Location' } },
                    { path: 'circulationfile', component: CirculationfileComponent , data: { permission: 'Pages.TechFile.Circulationfile' } }
                ] 
            }
        ])
    ],
    exports: [RouterModule]
})
export class TechFileRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
